.TH writeregioncode 3  "January 9, 2013" "version 4.0.002" "LPJmL programmers manual"
.SH NAME
writeregioncode \- Write region code file
.SH SYNOPSIS
.nf
\fB#include "lpj.h"

int writeregioncode(Outputfile *\fIoutput\fB,
                    int \fIindex\fB,
                    const Cell \fIgrid\fB[],
                    const Config *\fIconfig\fB   
                   );\fP

.fi
.SH DESCRIPTION
Function writes region code data for LPJmL grid. Only cell coordinates with valid soil code are written.  The arguments of \fBwriteregioncode\fP are:
.TP
.I output
Pointer to initialized output data. \fIoutput\fP must be initialized by \fBfopenoutput()\fP.
.TP
.I index
Set index of output.
.TP
.I grid
Cell grid array allocated and initialized by \fBnewgrid()\fP.
.TP
.I config
LPJmL configuration data. Must be read by \fBreadconfig()\fP.
.SH RETURN VALUE
Upon successful completion the number of region codes written is returned.

.SH AUTHORS

For authors and contributors see AUTHORS file

.SH COPYRIGHT

(C) Potsdam Institute for Climate Impact Research (PIK), see COPYRIGHT file

.SH SEE ALSO
readconfig(3), fopenoutput(3), newgrid(3), fcloseoutput(3), isopen(3), writecoords(3), writecountrycode(3)
